package com.android.settings.audio.peq.peq;

import com.android.settings.audio.peq.util.LogPlus;
import com.android.settings.audio.peq.util.SmartPlayerApplication;

/**
 * SmartAudio Native Interface
 *
 * @author ruishu.li@hibymusic.com
 * @since v0.1
 */
public class SmartAv {


    private static class LazyHolder {
        private static final SmartAv INSTANCE = new SmartAv();
    }

    public static final SmartAv getInstance() {
        return LazyHolder.INSTANCE;
    }

    private SmartAv() {

    }

    public /*native*/ void native_setPeqValue(String key, int value) {
        LogPlus.d("key:" + key + " ,value:" + value);
    }

    public /*native*/ void native_setPeqValue(String key, float value) {
        LogPlus.d("key:" + key + " ,value:" + value);
    }

    public /*native*/ void native_setPeqValueEnable(int value) {
        PeqAudioSettingUtils.getInstance().enablePeq(SmartPlayerApplication.getInstance(), value == 1, true, 0);
    }

    public void native_setPeqValuePreAmp(float preAmp) {
    }

    public void native_setPeqValuePreAmpEnable(int i) {
    }

    public void native_setPeqValueItem(int i, int on, float freq, float q, float gain, int filter) {
        PeqAudioSettingUtils.getInstance().setPeqItemParameter(SmartPlayerApplication.getInstance(), i, "freq", freq);
        PeqAudioSettingUtils.getInstance().setPeqItemParameter(SmartPlayerApplication.getInstance(), i, "q", q);
        PeqAudioSettingUtils.getInstance().setPeqItemParameter(SmartPlayerApplication.getInstance(), i, "gain", gain);
        PeqAudioSettingUtils.getInstance().setPeqItemParameter(SmartPlayerApplication.getInstance(), i, "filter", filter);
        PeqAudioSettingUtils.getInstance().setPeqItemParameter(SmartPlayerApplication.getInstance(), i, "enable", on);
    }

}
